New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@universal-packages/package-json

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@universal-packages/package-json

package.json utils

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.1K
decreased by-68.27%
Maintainers
0
Weekly downloads
 
Created
Source

Package Json

npm version Testing codecov

package.json utils.

Install

npm install @universal-packages/package-json

Global methods

readPackageJson([name: string])

Reads the package.json file as a JSON of the current working directory or if a package name is passed and its installed under node_modules the package.json is read from that package.

import { readPackageJson } from '@universal-packages/package-json'

const json = readPackageJson('jest')

console.log(json)

// > { name: 'jest', ...}

PackageJson

PackageJson for a more in deep mapping of the package.json file.

import { PackageJson } from '@universal-packages/package-json'

const packageJson = new PackageJson()

packageJson.read()

Instance methods

read()

Reads the root package.json file and all its dependencies recursively generating a new PackageJson object for ech dependency.

Properties

name:string

Name of the package being mapped.

version:string

Version of the package being mapped.

json: Object

The package.json object of the package being mapped.

flatDependencies: Object<PackageJson>

All the uniq dependencies read while reading recursively.

dependencies: Object<PackageJson>

Collection of all dependencies read as PackageJson objects.

devDependencies: Object<PackageJson>

Collection of all devDependencies read as PackageJson objects.

peerDependencies: Object<PackageJson>

Collection of all peerDependencies read as PackageJson objects.

peerDependenciesMeta: Object<PackageJson>

Collection of all peerDependenciesMeta read as PackageJson objects.

bundleDependencies: Object<PackageJson>

Collection of all bundleDependencies read as PackageJson objects.

optionalDependencies: Object<PackageJson>

Collection of all optionalDependencies read as PackageJson objects.

Typescript

This library is developed in TypeScript and shipped fully typed.

Contributing

The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.

License

MIT licensed.

FAQs

Package last updated on 30 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc